/*
 * 
 *     This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.

 * 
 * BoogieMan - 2009
 *
 */

using System;
using System.Collections.Generic;
using System.Text;

namespace WoW.DataManager
{
    /// <summary>WMO. Represents a World Map Object.</summary>
    public class WMO
    {
        private WMORootFile root;           // WMO Root
        private WMOGroupFile[] groups;      // WMO Groups

        public WMO(String filename)
        {
            root = new WMORootFile(filename);

            int num = root.groupInfo.Length;

            groups = new WMOGroupFile[num];

            // Load in Group Files
            for (int i = 0; i < num; i++)
            {
                StringBuilder sb = new StringBuilder(filename);
                sb.Remove(sb.Length - 4, 4); // Trim ".wmo"
                sb.Append("_");
                sb.Append(String.Format("{0:D3}", i));
                sb.Append(".wmo");

                groups[i] = new WMOGroupFile(sb.ToString());
            }
        }
    }
}